package com.yidiandao.business.ui.main.shoppingcart.choosecoupon;

import android.app.Activity;
import android.content.Intent;

import com.yidiandao.business.R;
import com.yidiandao.business.base.BaseActivity;
import com.yidiandao.business.data.model.CouponModel;
import com.yidiandao.business.utils.ActivityUtils;

/** 选择优惠券-Activity. */
public class ChooseCouponActivity extends BaseActivity {

    private ChooseCouponFragment mChooseCouponFragment;

    public static void actionStart(Activity activity) {
        Intent intent = new Intent(activity, ChooseCouponActivity.class);
        activity.startActivity(intent);
    }

    @Override
    protected void initFragment() {
        mChooseCouponFragment =
                (ChooseCouponFragment)
                        getSupportFragmentManager().findFragmentById(R.id.container_choose_coupon);

        if (mChooseCouponFragment == null) {
            mChooseCouponFragment = ChooseCouponFragment.getInstance(getIntent().getExtras());
            ActivityUtils.addFragmentToActivity(
                    getSupportFragmentManager(),
                    mChooseCouponFragment,
                    R.id.container_choose_coupon);
        }
    }

    @Override
    protected void initPresenter() {
        new ChooseCouponPresenter(mChooseCouponFragment,new CouponModel());
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_choose_coupon;
    }
}
